package org.example.service.Impl;

import org.example.config.R;
import org.example.domain.Dict;
import org.example.mapper.DictMapper;
import org.example.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class DictServiceImpl implements DictService {
    @Autowired
    DictMapper dictMapper;
    @Override
    public List<Dict> dictList(Dict dict) {
        return dictMapper.dictList(dict);
    }

    @Override
    public R dictAdd(Dict dict) {
        dict.setFlag(0);
        dict.setCreateTime(new Date());
        dictMapper.dictAdd(dict);
        return R.successed(null);
    }

    @Override
    public R delById(Integer id) {
        dictMapper.delById(id);
        return R.successed(null);
    }

    @Override
    public R updateById(Dict dict) {
        dictMapper.updateById(dict);
        return R.successed(null);
    }

    @Override
    public List<Dict> list() {
        return dictMapper.list();
    }
}
